package com.sms.msger.msg.dao.hibernate;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.sms.msger.msg.dao.IUserInfoSmsDao;
import com.sms.msger.msg.persistence.UserInfoSms;


public class UserInfoSmsDao extends HibernateDaoSupport implements IUserInfoSmsDao {
	private static final Log log = LogFactory.getLog(UserInfoSmsDao.class);
	
	@SuppressWarnings("unchecked")
	public UserInfoSms getUserInfoById(String userId) {
		log.debug("find userinfosms");
		try{
			List<UserInfoSms> list =  this.getHibernateTemplate().find("from UserInfoSms where userId = ?",userId);
			return list == null || list.size() ==0 ? null : list.get(0);
		}catch(RuntimeException re){
			log.error("find userinfosms by id="+userId+" failed:",re);
			throw re;
		}
	}

}